Skip to main content

Sugar - Collision Module

Introduction

Sugar cube collision module.png

Function


Signal

Digital output 1 (high level): module switch is in contact 0 (low level): module switch is not in contact

Module principle

The module uses a touch switch. When the switch is closed, the circuit generates a high-level signal

Wiring

Future Board Lite Motherboard 3 - Copy.png

Future Board Lite InterfaceWiring
Sugar Cube Collision Module.pngSugar Cube Collision ModulePort3White PH2.0-3Pin Interface Cableuntitled.100.png

warning: Supports connecting to Port1, Port2, Port3, Port4 When programming, make sure that the interface is consistent with the actual use

Blocks - Function Description

No.Block ImageBlock Function
1image-20240314163150198Detects whether the collision sensor is pressed

Program - Features

  1. Set the color screen to dot matrix mode
  2. Initialize the variable, responsible for recording the number of times the collision sensor is pressed
  3. Cyclic detection
  4. When the collision sensor is detected to be pressed
  5. Display a smiley face picture once, and increase X, then display X on the dot matrix screen
  6. When the collision sensor is not detected as pressed, the dot matrix screen displays a sad face image-20240314163515487

Using Kittenblock

Using the offline download mode to run the program to check the effects

Using Robotbit on Microbit

Robotbit_压缩后.png

Programming Platform

Microsoft MakeCode for micro:bit Use the Makecode programming platform

Add the Sugar plugin

image-20240311154521941 image.png

Search for Sugar in the extensions, click Add

Circuit Connection

image.png

Microbit InterfaceLine
Sugar Cube Collision Module.pngSugar Cube Collision ModuleP0White PH2.0-3Pin Interface Lineuntitled.100.png

warning Support connection at P0, P1, P8, P13, etc. Keep the interface consistent with the actual one during programming

Blocks - Function Description

No.Block ImageBlock Function
1image-20240314163056512Reads whether the collision module is collided with

Case: Collision Detection

image-20240314163044985